package com.mojo.response;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * @author <a href="mailto:sjj@jianzhimao.com">mojo</a>
 * copyright (C), 2013-2022, 广州九尾信息科技有限公司
 * @date 2022/4/22 15:20
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultListVO<T> implements Serializable {
    private Integer code;
    private String message;
    private List<T> data;

    public ResultListVO(Integer code, String message) {
        this(code, message, null);
    }

    public ResultListVO(List<T> data) {
        this(200, "操作成功");
        this.data = data;
    }

    public static <T> ResultListVO<T> fail() {
        return new ResultListVO<T>(500, "系统繁忙，使用回退", null);
    }
}
